Necessary change to support ia64/vti domain build in common code.
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Tue, 25 Oct 2005 02:57:47 +0000 (20:57 -0600)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Tue, 25 Oct 2005 02:57:47 +0000 (20:57 -0600)
Signed-off-by Ke Yu <ke.yu@intel.com>
Signed-off-by Anthony Xu <anthony.xu@intel.com>
Signed-off-by Kevin Tian <kevin.tian@intel.com>

tools/libxc/xc_private.c
tools/libxc/xenctrl.h
tools/python/xen/xend/image.py

index ea3798ebca905fdc2f59f41941f3b5167d11f3b2..75e179a7c7e85606f8cbaa56f30f2fcdef245286 100644 (file)
@@ -313,46 +313,6 @@ int xc_get_pfn_list(int xc_handle,
     return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
 }
 
-#ifdef __ia64__
-int xc_ia64_get_pfn_list(int xc_handle,
-                         uint32_t domid, 
-                         unsigned long *pfn_buf, 
-                         unsigned int start_page,
-                         unsigned int nr_pages)
-{
-    dom0_op_t op;
-    int ret;
-
-    op.cmd = DOM0_GETMEMLIST;
-    op.u.getmemlist.domain   = (domid_t)domid;
-    op.u.getmemlist.max_pfns = ((unsigned long)start_page << 32) | nr_pages;
-    op.u.getmemlist.buffer   = pfn_buf;
-
-    if ( mlock(pfn_buf, nr_pages * sizeof(unsigned long)) != 0 )
-    {
-        PERROR("Could not lock pfn list buffer");
-        return -1;
-    }    
-
-    /* XXX Hack to put pages in TLB, hypervisor should be able to handle this */
-    memset(pfn_buf, 0, nr_pages * sizeof(unsigned long));
-    ret = do_dom0_op(xc_handle, &op);
-
-    (void)munlock(pfn_buf, nr_pages * sizeof(unsigned long));
-
-    return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
-}
-
-long xc_get_max_pages(int xc_handle, uint32_t domid)
-{
-    dom0_op_t op;
-    op.cmd = DOM0_GETDOMAININFO;
-    op.u.getdomaininfo.domain = (domid_t)domid;
-    return (do_dom0_op(xc_handle, &op) < 0) ? 
-        -1 : op.u.getdomaininfo.max_pages;
-}
-#endif
-
 long xc_get_tot_pages(int xc_handle, uint32_t domid)
 {
     dom0_op_t op;
index 98408f25bf8cb75181c3b00fc177b2b0e42dd8e2..ffbe4fdfffa0d3f63e3b03cf65b64b2ed1f1e8a4 100644 (file)
@@ -414,6 +414,12 @@ int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid,
                          unsigned long *pfn_buf, 
                          unsigned int start_page, unsigned int nr_pages);
 
+int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
+                          unsigned long dst_pfn, void *src_page);
+
+int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
+        void* src_page, unsigned long dst_pfn, int nr_pages);
+
 long xc_get_max_pages(int xc_handle, uint32_t domid);
 
 int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
index 6cd9f540f396a69455a571090b10d28272ffd12b..b6c82090567636e615ca6b86524b498dc5f912f9 100644 (file)
@@ -342,12 +342,15 @@ class VmxImageHandler(ImageHandler):
 
     def getDomainMemory(self, mem):
         """@see ImageHandler.getDomainMemory"""
+       page_kb = 4
+       if os.uname()[4] == 'ia64':
+           page_kb = 16
         # for ioreq_t and xenstore
         static_pages = 2
-        return mem + self.getPageTableSize(mem / 1024) + 4 * static_pages
+        return mem + (self.getPageTableSize(mem / 1024) + static_pages) * page_kb
             
     def getPageTableSize(self, mem_mb):
-        """Return the size of memory needed for 1:1 page tables for physical
+        """Return the pages of memory needed for 1:1 page tables for physical
            mode.
 
         @param mem_mb: size in MB
@@ -355,13 +358,13 @@ class VmxImageHandler(ImageHandler):
         """
         # 1 page for the PGD + 1 pte page for 4MB of memory (rounded)
         if os.uname()[4] == 'x86_64':
-            return (5 + ((mem_mb + 1) >> 1)) * 4
+            return 5 + ((mem_mb + 1) >> 1)
         elif os.uname()[4] == 'ia64':
-            # XEN/IA64 has p2m table allocated on demand, so only return
-            # guest firmware size here.
-            return 16 * 1024
+            # 1:1 pgtable is allocated on demand ia64, so just return rom size
+           # for guest firmware
+            return 1024
         else:
-            return (1 + ((mem_mb + 3) >> 2)) * 4
+            return 1 + ((mem_mb + 3) >> 2)
 
 
 """Table of image handler classes for virtual machine images.  Indexed by